package game.craft.model;

import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.image.ImageObserver;

/**
 * Created by IntelliJ IDEA.
 * User: ccayirog
 * Date: Mar 27, 2011
 * Time: 12:14:17 AM
 * To change this template use File | Settings | File Templates.
 */
public class Missile extends AbstractItem implements Item {

    private final int BOARD_WIDTH = 390;
    private final int MISSILE_SPEED = 2;

    public Missile(int x, int y) {
        super("D:\\Documents and Settings\\ccayirog\\Desktop\\my_game\\images\\missile.png", x, y);
    }

    public void move() {
        x += MISSILE_SPEED;
        if (x > BOARD_WIDTH)
            exist = false;
    }

    public void keyPressed(KeyEvent e) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    public void keyReleased(KeyEvent e) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    public void draw(Graphics graphics, ImageObserver observer) {
        if (exist)
            graphics.drawImage(image, x, y, observer);
    }
}
